import { Y as getHelpCenterListApi, Z as getHelpCenterDetailApi, $ as getContactUsListApi } from "../entry-server.js";
import { defineStore } from "pinia";
const useHelpCenterStore = defineStore("helpCenter", {
  state: () => ({
    helpCenterList: [],
    issueList: [],
    helpCenterDetail: {},
    relatedQuestions: []
  }),
  actions: {
    getHelpCenterListData() {
      if (this.helpCenterList.length) {
        return Promise.resolve(this.helpCenterList);
      } else {
        return getHelpCenterListApi().then((content) => {
          var _a;
          this.helpCenterList = ((_a = content == null ? void 0 : content.help_center_titles) == null ? void 0 : _a.level2_titles) || [];
          return this.helpCenterList;
        });
      }
    },
    getHelpCenterDetailData(id) {
      if (Object.keys(this.helpCenterDetail).length) {
        return Promise.resolve(this.helpCenterDetail);
      } else {
        return getHelpCenterDetailApi({ id }).then((detail) => {
          this.helpCenterDetail = detail;
          return detail;
        });
      }
    },
    getRelatedQuestions() {
      return new Promise((resolve) => {
        this.relatedQuestions = Array.from({ length: 3 });
        resolve(this.relatedQuestions);
      });
    },
    getIssueListData() {
      if (this.issueList.length) {
        return Promise.resolve(this.issueList);
      } else {
        return getContactUsListApi().then((data) => {
          this.issueList = data.contact_us_titles;
          return data.contact_us_titles;
        });
      }
    }
  }
});
export {
  useHelpCenterStore as u
};
